package com.power.web.action.aboutus;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.power.model.aboutus.TsAboutus;
import com.power.services.aboutus.TsAboutusService;
import com.power.util.RequestUtil;
import com.power.web.action.base.AbstractBaseAction;

public class TsAboutusAction extends AbstractBaseAction {
    
    @Autowired
    @Qualifier("tsAboutusService")
    private TsAboutusService tsAboutusService;
    
    private TsAboutus tsAboutus;
    
    public String saveOrUpdate() {
        this.response.reset();
        this.response.setCharacterEncoding("UTF-8");
        try {
            if (null != tsAboutus) {
                tsAboutusService.saveOrUpdate(tsAboutus);
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    
    public String read() {
        int id = RequestUtil.getParam(this.request, "id", -1);
        try {
        tsAboutus = this.tsAboutusService.read(new Integer(id));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "showaboutus";
    }
    
    public String show() {
        int id = RequestUtil.getParam(this.request, "id", -1);
        try {
        tsAboutus = this.tsAboutusService.read(new Integer(id));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "aboutus";
    }

    public TsAboutus getTsAboutus() {
        return tsAboutus;
    }

    public void setTsAboutus(TsAboutus tsAboutus) {
        this.tsAboutus = tsAboutus;
    }
    
    
}